package com.meadvc.ssmdemo.controller;

import com.alibaba.fastjson.JSONObject;
import com.meadvc.ssmdemo.service.ComponentService;
import com.meadvc.ssmdemo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @program: ssm-demo
 * @description: 订单控制类
 * @author: meadvc
 * @create: 2020-06-15 21:51
 **/
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 得到订单列表
     * @param
     * @return
     */
    @PostMapping("/getOrder")
    @CrossOrigin
    public JSONObject listComponent(@RequestBody JSONObject requestJson) {
        //System.out.println(requestJson);
        return orderService.getOrder(requestJson);
    }

    @PostMapping("/updateOrder")
    @CrossOrigin
    public JSONObject updateOrder(@RequestBody JSONObject requestJson) {
        //System.out.println(requestJson);
        return orderService.updateOrder(requestJson);
    }

    @PostMapping("/deleteComp")
    @CrossOrigin
    public JSONObject deleteComp(@RequestBody JSONObject requestJson) {
        //System.out.println(requestJson);
        return orderService.deleteComp(requestJson);
    }
}
